package com.lin.mr.maizilaundry.myadapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lin.mr.maizilaundry.R;
import com.lin.mr.maizilaundry.entity.Laundry;

import java.util.List;

/**
 * Created by lenovog on 2016/8/25.
 */
public class UnpayAdaper extends BaseAdapter {
    private Context context;
    private List<Laundry> laundryList;

    public UnpayAdaper(Context context, List<Laundry> laundryList) {
        this.context = context;
        this.laundryList = laundryList;
    }

    @Override
    public int getCount() {
        return laundryList.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if (convertView == null){
            convertView = View.inflate(context, R.layout.item_list_unpay,null);
            vh = new ViewHolder();
            vh.order_number = (TextView) convertView.findViewById(R.id.order_number);
            vh.order_name = (TextView) convertView.findViewById(R.id.order_name);
            vh.order_price = (TextView) convertView.findViewById(R.id.order_price);
            convertView.setTag(vh);
        }else {
            vh = (ViewHolder) convertView.getTag();
        }
        Laundry laundry = laundryList.get(position);
        vh.order_number.setText("订单号:"+laundry.getTime());
        vh.order_name.setText("衣服名称:"+laundry.getPictureName());
        vh.order_price.setText(laundry.getValue());
        return convertView;
    }

    class ViewHolder{
        TextView order_number;
        TextView order_name;
        TextView order_price;
    }
}
